package com.ruoyi.center.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.center.domain.*;
import com.ruoyi.center.service.*;

/**
 * 中心信息公开访问Controller（供visit前端调用，无需权限）
 *
 * @author ruoyi
 * @date 2025-11-09
 */
@RestController
@RequestMapping("/center/public")
public class CenterPublicController extends BaseController
{
    @Autowired
    private ICenterBasicService centerBasicService;

    @Autowired
    private IAffiliatedUnitService affiliatedUnitService;

    @Autowired
    private IDepartmentService departmentService;

    @Autowired
    private IManagementTeamService managementTeamService;

    @Autowired
    private IExpertCommitteeService expertCommitteeService;

    @Autowired
    private IResearchDirectionService researchDirectionService;

    /**
     * 查询中心基本信息列表（公开访问）
     */
    @GetMapping("/basic/list")
    public TableDataInfo listBasic(CenterBasic centerBasic)
    {
        startPage();
        List<CenterBasic> list = centerBasicService.selectCenterBasicList(centerBasic);
        return getDataTable(list);
    }

    /**
     * 查询依托与共建单位列表（公开访问）
     */
    @GetMapping("/unit/list")
    public TableDataInfo listUnit(AffiliatedUnit affiliatedUnit)
    {
        startPage();
        List<AffiliatedUnit> list = affiliatedUnitService.selectAffiliatedUnitList(affiliatedUnit);
        return getDataTable(list);
    }

    /**
     * 查询部门信息列表（公开访问）
     */
    @GetMapping("/department/list")
    public TableDataInfo listDepartment(Department department)
    {
        startPage();
        List<Department> list = departmentService.selectDepartmentList(department);
        return getDataTable(list);
    }

    /**
     * 查询管理团队列表（公开访问）
     */
    @GetMapping("/management/list")
    public TableDataInfo listManagement(ManagementTeam managementTeam)
    {
        startPage();
        List<ManagementTeam> list = managementTeamService.selectManagementTeamList(managementTeam);
        return getDataTable(list);
    }

    /**
     * 查询专家委员会列表（公开访问）
     */
    @GetMapping("/expert/list")
    public TableDataInfo listExpert(ExpertCommittee expertCommittee)
    {
        startPage();
        List<ExpertCommittee> list = expertCommitteeService.selectExpertCommitteeList(expertCommittee);
        return getDataTable(list);
    }

    /**
     * 查询研究方向列表（公开访问）
     */
    @GetMapping("/direction/list")
    public TableDataInfo listDirection(ResearchDirection researchDirection)
    {
        startPage();
        List<ResearchDirection> list = researchDirectionService.selectResearchDirectionList(researchDirection);
        return getDataTable(list);
    }
}